package com.yunpuvip.sachet.modular.page;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.util.Collections;
import java.util.List;

/**
 * redis 分页对象
 *
 * @author hyf
 * @date 2019/5/8
 **/
@Data
public class RedisPage<T> {
    /**
     * 查询数据列表
     */
    private List<T> records = Collections.emptyList();
    /**
     * 总数
     */
    private long total = 0;
    /**
     * 每页显示条数，默认 10
     */
    private long size = 10;
    /**
     * 当前页
     */
    private long current = 1;

    /**
     * 总页数
     */
    private long pages = 1;

    @JsonIgnore
    private int startIndex = 0;

    @JsonIgnore
    private int endIndex = 0;

    public RedisPage() {
    }

    public RedisPage(long current, long size) {
        this.current = current;
        this.size = size;
    }
}
